package com.common.rest;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;

public class SessionService {

	@GET
	@Path("/currentUser")
	@Produces(MediaType.APPLICATION_JSON)
	public UserDetails getCurrentUser() {
		return (UserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	}
}
